Location: 38.92424395477514, -77.04016100977317
df <- load_data("https://docs.google.com/spreadsheets/d/e/2PACX-1vRgKVv6YYIMV3z9G2INEcIu9h1KlVMV_XuHt2VBuC0s6fKOFQ_4d-fkJkvKuA4hWw/pub?gid=2043751314&single=true&output=csv")
# remove data sampled when I was walking to the spot at Columbia Rd and Ontario NW.
# It would be interesting to record in my neighborhood but that is not the point right now.
df <- df[200:nrow(df),]
mean_val <- round(mean(df$Noise_dB), 2)
p <- make_basic_graph(df, 'Noise levels at a bus stop on Columbia Road around 6:30 pm on a weeknight', y_min = 45)
## Warning in geom_point(data = df[ii, ], aes(x = Record, y = Noise_dB, text = Notes), : Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
p <- p +
geom_hline(aes(yintercept=mean_val), color='blue') +
annotate("text", x = max(df$Record)-80, y = 95,
size=4,
color='blue',
label = paste0('mean: ', mean_val, ' dBA'))
ggplotly(p, tooltip = 'text')
quantile(df$Noise_dB, .82)
## 82%
## 65
df$threshold <- ifelse(df$Noise_dB>=65, yes=TRUE, no=FALSE)
ggplot(data=df,) +
geom_histogram(aes(x=df$Noise_dB, fill=df$threshold), binwidth=.3) +
# geom_vline(xintercept=65, color='red') +
scale_fill_manual(values = c("darkgrey", "#109c37")) +
theme_minimal() +
annotate("text", x = 80, y = 40,
label = "18% of the time, the noise level exceeds 65 dBA.",
color='black') +
ylab('frequency') +
xlab("Noise (dB)")
## Warning: Use of `df$Noise_dB` is discouraged.
## ℹ Use `Noise_dB` instead.
## Warning: Use of `df$threshold` is discouraged.
## ℹ Use `threshold` instead.
Location: 38.90348142163074, -76.94311706948615
df <- load_data('https://docs.google.com/spreadsheets/d/e/2PACX-1vT7ItfiE7AaBTt7wPTzEjR6jFpCJAJ3XV_jeg2xS7IuR8bqwfQJ0mDb8wlOvNpxaz7ehhIzm1oY7kwi/pub?gid=1763293624&single=true&output=csv')
p <- make_basic_graph(df, 'Noise levels at a bus stop near Kenilworth Expressway around noon on a Sunday', y_min = 45)
## Warning in geom_point(data = df[ii, ], aes(x = Record, y = Noise_dB, text = Notes), : Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
freeway_start = 110
freeway_end = 685
freeway_y_val = mean(df$Noise_dB[df$Record > freeway_start & df$Record < freeway_end])
car_start = 777
car_end = 1435
car_y_val = mean(df$Noise_dB[df$Record > car_start & df$Record < car_end])
p <-
p +
geom_segment(aes(x = freeway_start, y = freeway_y_val, xend = freeway_end, yend = freeway_y_val), colour = "blue") +
geom_segment(aes(x = car_start, y = car_y_val, xend = car_end, yend = car_y_val), colour = "blue")
ggplotly(p, tooltip = 'text')
## Warning in geom_segment(aes(x = freeway_start, y = freeway_y_val, xend = freeway_end, : All aesthetics have length 1, but the data has 1882 rows.
## ℹ Did you mean to use `annotate()`?
## Warning in geom_segment(aes(x = car_start, y = car_y_val, xend = car_end, : All aesthetics have length 1, but the data has 1882 rows.
## ℹ Did you mean to use `annotate()`?
df <- load_data('https://docs.google.com/spreadsheets/d/e/2PACX-1vT7ItfiE7AaBTt7wPTzEjR6jFpCJAJ3XV_jeg2xS7IuR8bqwfQJ0mDb8wlOvNpxaz7ehhIzm1oY7kwi/pub?gid=560260845&single=true&output=csv')
p <- make_basic_graph(df, 'Noise levels on my morning commute on a Tuesday', y_min=25)
## Warning in geom_point(data = df[ii, ], aes(x = Record, y = Noise_dB, text = Notes), : Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
## Ignoring unknown aesthetics: text
for (id_pairs in list(c(1, 425), c(425, 931), c(931, 2161), c(2161, 2822))) {
mean_val = mean(df$Noise_dB[df$Record >= id_pairs[1] & df$Record <= id_pairs[2]])
p <-
p +
annotate("segment", x = id_pairs[1], y = mean_val, xend = id_pairs[2], yend = mean_val, colour = "blue")
}
ggplotly(p, tooltip = 'text')
df <- load_data('https://docs.google.com/spreadsheets/d/e/2PACX-1vT7ItfiE7AaBTt7wPTzEjR6jFpCJAJ3XV_jeg2xS7IuR8bqwfQJ0mDb8wlOvNpxaz7ehhIzm1oY7kwi/pub?gid=515952561&single=true&output=csv')
df <-
df %>%
filter(
(Notes == "Location=17st in front of Annie's Steaks" & Record < 615) |
(Notes == "Location=14st, in front of Rice Market")
)
p <-
ggplot(data=df, aes(x=Record, y=Noise_dB, color=as.factor(Notes))) +
geom_line() +
scale_y_continuous(breaks = seq(35, 95, by = 5)) +
scale_x_continuous(breaks=seq(1, 660, 60),
label=round(seq(1, 660, 60) / 60, 0) ) +
theme_minimal() +
xlab('Time in minutes') +
ylab('Decibel level') +
labs(color='Location') +
ggtitle("Less traffic noise on 17th St than 14th St") +
annotate("segment",
x = 1, y = mean(df$Noise_dB[df$Notes == "Location=14st, in front of Rice Market" ]),
xend = max(df$Record), yend = mean(df$Noise_dB[df$Notes == "Location=14st, in front of Rice Market" ]),
colour = "darkgrey") +
annotate("segment",
x = 1, y = mean(df$Noise_dB[df$Notes == "Location=17st in front of Annie's Steaks" ]),
xend = max(df$Record), yend = mean(df$Noise_dB[df$Notes == "Location=17st in front of Annie's Steaks" ]),
colour = "darkgrey") +
scale_color_manual(labels = c("14th St near Rice Bar", "17th St near Annie's"), values = c("orange", "blue"))
p